package com.njwb.day17;

public class MultiThreadDemo {
    public static void main(String[] args) {
        // 线程1：继承 Thread
        Thread t1 = new Thread() {
            @Override
            public void run() {
                for (int i = 1; i <= 100; i++) {
                    System.out.println("🍎 苹果线程：" + i);

                }
            }
        };

        // 线程2：实现 Runnable
        Runnable task = new Runnable() {
            @Override
            public void run() {
                for (int i = 1; i <= 100; i++) {
                    System.out.println("🍌 香蕉线程：" + i);

                }
            }
        };
        Thread t2 = new Thread(task);

        t1.start();
        t2.start();

        for (int i = 1; i <= 100; i++) {
            System.out.println("🏠 主线程：" + i);

        }
    }
}
